<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>tft: xtft_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">tft
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xtft__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xtft_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the driver functions of the <a class="el" href="struct_x_tft.html" title="This structure is the base for whole of the operations that are to be performed on the TFT screen...">XTft</a> driver. </p>
<p>This example shows the usage of the driver/device to</p>
<ul>
<li>Write a character and write a string of characters</li>
<li>Draw a line</li>
<li>Turn ON/OFF the TFT Device</li>
</ul>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>TFT_FRAME_ADDR specifies the starting address of the 2MB space for storing the frame data and has to be defined by the user based on the system memory map.</p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver    Who   Date      Changes
</p>
<hr/>
<p>
1.00a  sg    03/24/08  First release
1.00a  sg    09/24/08  Updated the example to update the Video Memory Base
                 Address with the Memory specified by the application
2.00a  ktn   07/09/09  Updated the example to poll the Vsync(Video address
                 latch) status bit before writing to the Address
                 Register (AR)
4.00a  bss   01/22/13  Updated the example to use DDR_HIGH_ADDR to support
                 for some AXI memory controllers, User needs to define
                 it with a valid address.
6.00   ms    01/23/17 Added xil_printf statement in main function to
                      ensure that "Successfully ran" and "Failed" strings
                      are available in all examples. This is a fix for
                      CR-965028.
6.4   sd     07/08/23 Added SDT support.
6.6   sd     12/16/24 Update the DDR_HIGH_ADDR to support BRAM..</pre><pre></pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a2591110053c07a10b447f0473eb9d5ce"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#a2591110053c07a10b447f0473eb9d5ce">TFT_DEVICE_ID</a>&#160;&#160;&#160;XPAR_TFT_0_DEVICE_ID</td></tr>
<tr class="memdesc:a2591110053c07a10b447f0473eb9d5ce"><td class="mdescLeft">&#160;</td><td class="mdescRight">The following constants map to the XPAR parameters created in the xparameters.h file.  <a href="#a2591110053c07a10b447f0473eb9d5ce">More...</a><br/></td></tr>
<tr class="separator:a2591110053c07a10b447f0473eb9d5ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4e5b258835a007d43f1eac8a5f60fe55"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#a4e5b258835a007d43f1eac8a5f60fe55">TFT_FRAME_ADDR</a>&#160;&#160;&#160;DDR_HIGH_ADDR - 0x001FFFFF</td></tr>
<tr class="memdesc:a4e5b258835a007d43f1eac8a5f60fe55"><td class="mdescLeft">&#160;</td><td class="mdescRight">User has to specify a 2MB memory space for filling the frame data.  <a href="#a4e5b258835a007d43f1eac8a5f60fe55">More...</a><br/></td></tr>
<tr class="separator:a4e5b258835a007d43f1eac8a5f60fe55"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a27bab78a5956de44e87eab983a9f8783"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#a27bab78a5956de44e87eab983a9f8783">FGCOLOR_VALUE</a>&#160;&#160;&#160;0x0000FF00</td></tr>
<tr class="memdesc:a27bab78a5956de44e87eab983a9f8783"><td class="mdescLeft">&#160;</td><td class="mdescRight">Color Values.  <a href="#a27bab78a5956de44e87eab983a9f8783">More...</a><br/></td></tr>
<tr class="separator:a27bab78a5956de44e87eab983a9f8783"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa2e911a0e8fa78132f9baffbf26ebd73"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#aa2e911a0e8fa78132f9baffbf26ebd73">BGCOLOR_VALUE</a>&#160;&#160;&#160;0x0</td></tr>
<tr class="memdesc:aa2e911a0e8fa78132f9baffbf26ebd73"><td class="mdescLeft">&#160;</td><td class="mdescRight">Background Color - Black.  <a href="#aa2e911a0e8fa78132f9baffbf26ebd73">More...</a><br/></td></tr>
<tr class="separator:aa2e911a0e8fa78132f9baffbf26ebd73"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2d24b990c00e26930d01f4179147cb59"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#a2d24b990c00e26930d01f4179147cb59">WHITECOLOR_VALUE</a>&#160;&#160;&#160;0x00FFFFFF</td></tr>
<tr class="memdesc:a2d24b990c00e26930d01f4179147cb59"><td class="mdescLeft">&#160;</td><td class="mdescRight">Color - White.  <a href="#a2d24b990c00e26930d01f4179147cb59">More...</a><br/></td></tr>
<tr class="separator:a2d24b990c00e26930d01f4179147cb59"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa4d3ff9341955d632e5107848bb2e9a7"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#aa4d3ff9341955d632e5107848bb2e9a7">X1POS</a>&#160;&#160;&#160;100</td></tr>
<tr class="memdesc:aa4d3ff9341955d632e5107848bb2e9a7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start and End point Coordinates for the line.  <a href="#aa4d3ff9341955d632e5107848bb2e9a7">More...</a><br/></td></tr>
<tr class="separator:aa4d3ff9341955d632e5107848bb2e9a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6654e71fdd217d10e9445d8d2939d8ae"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#a6654e71fdd217d10e9445d8d2939d8ae">X2POS</a>&#160;&#160;&#160;100</td></tr>
<tr class="memdesc:a6654e71fdd217d10e9445d8d2939d8ae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Column End Position.  <a href="#a6654e71fdd217d10e9445d8d2939d8ae">More...</a><br/></td></tr>
<tr class="separator:a6654e71fdd217d10e9445d8d2939d8ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a939dbc13f86ffcd1cc75869dfba9c9f7"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#a939dbc13f86ffcd1cc75869dfba9c9f7">Y1POS</a>&#160;&#160;&#160;50</td></tr>
<tr class="memdesc:a939dbc13f86ffcd1cc75869dfba9c9f7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Row Start Position.  <a href="#a939dbc13f86ffcd1cc75869dfba9c9f7">More...</a><br/></td></tr>
<tr class="separator:a939dbc13f86ffcd1cc75869dfba9c9f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ba6644e505663efa5d41d4989c7d344"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#a8ba6644e505663efa5d41d4989c7d344">Y2POS</a>&#160;&#160;&#160;450</td></tr>
<tr class="memdesc:a8ba6644e505663efa5d41d4989c7d344"><td class="mdescLeft">&#160;</td><td class="mdescRight">Row End Position.  <a href="#a8ba6644e505663efa5d41d4989c7d344">More...</a><br/></td></tr>
<tr class="separator:a8ba6644e505663efa5d41d4989c7d344"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ac6b91e875cb351724fcbf7314572ed26"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample</a> (u32 TftDeviceId)</td></tr>
<tr class="memdesc:ac6b91e875cb351724fcbf7314572ed26"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the example function which performs the following operations on the TFT device -.  <a href="#ac6b91e875cb351724fcbf7314572ed26">More...</a><br/></td></tr>
<tr class="separator:ac6b91e875cb351724fcbf7314572ed26"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xtft__example_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function that invokes the Tft example.  <a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">More...</a><br/></td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="aa2e911a0e8fa78132f9baffbf26ebd73"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BGCOLOR_VALUE&#160;&#160;&#160;0x0</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Background Color - Black. </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a27bab78a5956de44e87eab983a9f8783"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FGCOLOR_VALUE&#160;&#160;&#160;0x0000FF00</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Color Values. </p>
<p>Foreground Color - Green </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a2591110053c07a10b447f0473eb9d5ce"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TFT_DEVICE_ID&#160;&#160;&#160;XPAR_TFT_0_DEVICE_ID</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The following constants map to the XPAR parameters created in the xparameters.h file. </p>
<p>They are defined here such that a user can easily change all the needed parameters in one place. </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main()</a>.</p>

</div>
</div>
<a class="anchor" id="a4e5b258835a007d43f1eac8a5f60fe55"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TFT_FRAME_ADDR&#160;&#160;&#160;DDR_HIGH_ADDR - 0x001FFFFF</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>User has to specify a 2MB memory space for filling the frame data. </p>
<p>This constant has to be updated based on the memory map of the system. </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a2d24b990c00e26930d01f4179147cb59"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define WHITECOLOR_VALUE&#160;&#160;&#160;0x00FFFFFF</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Color - White. </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<a class="anchor" id="aa4d3ff9341955d632e5107848bb2e9a7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define X1POS&#160;&#160;&#160;100</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start and End point Coordinates for the line. </p>
<p>Column Start Position </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a6654e71fdd217d10e9445d8d2939d8ae"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define X2POS&#160;&#160;&#160;100</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Column End Position. </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a939dbc13f86ffcd1cc75869dfba9c9f7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define Y1POS&#160;&#160;&#160;50</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Row Start Position. </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a8ba6644e505663efa5d41d4989c7d344"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define Y2POS&#160;&#160;&#160;450</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Row End Position. </p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function that invokes the Tft example. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XST_FAILURE if unsuccessful.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xtft__example_8c.html#a2591110053c07a10b447f0473eb9d5ce">TFT_DEVICE_ID</a>, and <a class="el" href="xtft__example_8c.html#ac6b91e875cb351724fcbf7314572ed26">TftExample()</a>.</p>

</div>
</div>
<a class="anchor" id="ac6b91e875cb351724fcbf7314572ed26"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int TftExample </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>TftDeviceId</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the example function which performs the following operations on the TFT device -. </p>
<ul>
<li>Set the color values of foreground and background</li>
<li>Write two characters (S) one after another</li>
<li>Write a string of characters</li>
<li>Draw a line and scroll the screen once</li>
<li>Disable the display (The screen goes blank)</li>
<li>Scroll the screen once and draw a line</li>
<li>Enable the TFT display</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">TftDeviceId</td><td>is the unique Id of the device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XST_FAILURE if unsuccessful.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="struct_x_tft___config.html#af13b84d730fc82272b844c4f787a5142">XTft_Config::BaseAddress</a>, <a class="el" href="xtft__example_8c.html#aa2e911a0e8fa78132f9baffbf26ebd73">BGCOLOR_VALUE</a>, <a class="el" href="xtft__example_8c.html#a27bab78a5956de44e87eab983a9f8783">FGCOLOR_VALUE</a>, <a class="el" href="xtft__example_8c.html#a4e5b258835a007d43f1eac8a5f60fe55">TFT_FRAME_ADDR</a>, <a class="el" href="xtft__example_8c.html#a2d24b990c00e26930d01f4179147cb59">WHITECOLOR_VALUE</a>, <a class="el" href="xtft__example_8c.html#aa4d3ff9341955d632e5107848bb2e9a7">X1POS</a>, <a class="el" href="xtft__example_8c.html#a6654e71fdd217d10e9445d8d2939d8ae">X2POS</a>, <a class="el" href="group__tft.html#ga7cb92a2667272b013b8fccb0df1307ad">XTft_CfgInitialize()</a>, <a class="el" href="group__tft.html#ga4181b68f12ba322250de4e29ef453abe">XTft_ClearScreen()</a>, <a class="el" href="group__tft.html#ga5324d540859b06ca950fbf07d466a7fe">XTft_DisableDisplay()</a>, <a class="el" href="group__tft.html#ga308d28143a386bcde54db714f43ae737">XTft_EnableDisplay()</a>, <a class="el" href="group__tft.html#gacc8325682d029d3618ff0a7d6ee265dc">XTft_GetVsyncStatus()</a>, <a class="el" href="group__tft.html#gafcc9028848f7ab88a9461c53a5c64bf0">XTFT_IESR_VADDRLATCH_STATUS_MASK</a>, <a class="el" href="group__tft.html#ga49bd9cf75d37adc0157a433b9f57db0f">XTft_LookupConfig()</a>, <a class="el" href="group__tft.html#ga40c2b5ed76baff0d64b5a78b67620184">XTft_Scroll()</a>, <a class="el" href="group__tft.html#ga689206aec1006c6231f4b10062a8eeb0">XTft_SetColor()</a>, <a class="el" href="group__tft.html#ga56ccbb6cd6478cd5bd330ef70f733b4a">XTft_SetFrameBaseAddr()</a>, <a class="el" href="group__tft.html#ga1cc88ecc501ab053fdccbcb270315068">XTft_Write()</a>, <a class="el" href="xtft__example_8c.html#a939dbc13f86ffcd1cc75869dfba9c9f7">Y1POS</a>, and <a class="el" href="xtft__example_8c.html#a8ba6644e505663efa5d41d4989c7d344">Y2POS</a>.</p>

<p>Referenced by <a class="el" href="xtft__example_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
